package com.eip.zd.controller;

import com.eip.zd.common.Result;
import com.eip.zd.entity.Pay;
import com.eip.zd.service.PayService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/pay")
public class PayController {
    @Resource
    private PayService payService;
    @GetMapping("/getPayList")
    public Result getPayList(@RequestParam(required = false) String keyword) {
        List<Pay> payList = payService.getPayList(keyword);
        return Result.success(payList);
    }
    @PostMapping("/add")
    public Result addPay(@RequestBody Pay pay) {
        payService.add(pay);
        return Result.success();
    }
    @PostMapping("/update")
    public Result updatePay(@RequestBody Pay pay) {
        payService.update(pay);
        return Result.success();
    }
    @PostMapping("/remove/{id}")
    public Result removePay(@PathVariable Long id) {
        payService.remove(id);
        return Result.success();
    }
    @PostMapping("/ifUse/{id}")
    public Result ifUse(@PathVariable Long id) {
        payService.ifUse(id);
        return Result.success();
    }
}
